<!-- 机构端-我的主页 -->
<template>
	<view class="my-page">
		<!-- 顶部用户信息区域 -->
		<view class="user-info"  @click="navigateTo('enterInfo')">
			<!-- 头像 -->
			<view class="info-left">
				<u-avatar size="100" :src="userInfo.qyxx.logo_img_uri[0].url"></u-avatar>
			</view>
			<view class="info-right">
				<view class="company-name">{{ userInfo.qyxx.qyxx_name }}</view>
				<view class="phone">{{ userInfo.base.user_phoneno }}</view>
				<view class="company-type">
					<text>{{ userInfo.qyxx.qyxx_type }}</text>
					<text class="main-string">|</text>
					<text>{{ userInfo.qyxx.qyxx_jyzt }}</text>
				</view>
			</view>
      <view>
				<u-section :show-line="false" sub-title=" "></u-section>
      </view>
		</view>

		<!-- 营业执照认证 -->
		<view class="certification" @click="navigateTo('business')">
			<view class="cert-item">
				<text>营业执照</text>
				<text class="cert-status">已认证</text>
			</view>
		</view>

		<!-- 图文导航 -->
		<view class="dial-nav">
			<dial-nav marginTopLine='22rpx' imgSize='84rpx' :mode="3" :list="dialNavList"></dial-nav>		
		</view>

		<!-- 功能列表 -->
		<view class="function-list">
			<!-- 申请内训 -->
			<u-cell-item icon="edit-pen" title="申请内训" @click="navigateTo('training')"></u-cell-item>

			<!-- 客服 -->
			<u-cell-item icon="server-fill" title="联系客服" @click="navigateTo('makePhoneCall')"></u-cell-item>

			<!-- 等级评价机构 -->
			<u-cell-item icon="team-fill" title="等级评价机构" @click="navigateTo('levelEvaluation')"></u-cell-item>
			
			<!-- 人才与商务合作 -->
			<u-cell-item icon="team-fill" title="人才与商务合作" @click="navigateTo('cooperation')"></u-cell-item>

			<!-- 账号与设置 -->
			<u-cell-item icon="setting-fill" title="账号与设置" @click="navigateTo('organSetting')"></u-cell-item>
		</view>
	</view>
</template>

<script>
	import DialNav from '@/components/nav/dial-nav.vue';
	export default {
		components: {
			DialNav
		},
		data() {
			return {
				userInfo: {
					avatar: 'https://cdn.uviewui.com/uview/template/niannian.jpg',
					companyName: '企业名称',
					phone: '156****6666',
					companyType: '养老院',
					businessStatus: '营业中',
					licenseStatus: '已认证'
				},
				// 顶部导航
				dialNavList: [
					{
						img: require('static/nav/nav-community.png'),
						name: '报名记录',
						url: 'pages/Institution/record/record',
						params: {}
					},
					{
						img: require('static/nav/nav-recommond.png'),
						name: '已收简历',
						url: 'pages/Institution/invite/resume',
						params: {}
					},
					{
						img: require('static/nav/nav-points.png'),
						name: '面试记录',
						url: 'pages/Institution/invite/invite-record',
						params: {}
					},
				],
				enterCode:'mine'
			}
		},
		onShow() {
			// 获取企业信息
			this.getQyxx()
		},
		methods: {
			// 获取企业信息
			getQyxx() {
				this.$u.api.queryjgqyxx({
					"usercode": uni.getStorageSync('usercode')
				}).then(res => {
					
					this.userInfo = res.data.base_info
					console.log('企业信息：', res,this.userInfo)
				})
				
			},
			navigateTo(page) {
				// 实际项目中替换为你的页面路径
				const routes = {
					'enterInfo': `/pages/Institution/settleIn/enterpriseInfo?enterCode=${this.enterCode}`,
					'business': `/pages/Institution/settleIn/businessLicense?enterCode=${this.enterCode}`,
					'cooperation': '/pages/test/service',
					'training': '/pages/Institution/training/training',
					'levelEvaluation': '/pages/Institution/levelEvaluation/levelEvaluation',
					'organSetting': '/pages/Institution/organSetting/organSetting',
					'makePhoneCall': '/pages/Institution/mine/makePhoneCall'
				}
				uni.navigateTo({
					url: routes[page]
				})
			},
			contactService() {
				uni.makePhoneCall({
					phoneNumber: '400-123-4567'
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.my-page {
		padding: 20rpx;
		background-color: #f5f5f5;
		min-height: 100vh;
	}

	.user-info {
		display: flex;
		justify-content: space-between;
		align-items: center;
		padding: 30rpx;
		background-color: #fff;
		border-radius: 16rpx;
		margin-bottom: 4rpx;
		

		.info-right {
			flex: 1;
			display: flex;
			flex-direction: column;
			justify-content: center;
			margin-left: 20px;
			

			.company-name {
				font-size: 36rpx;
				font-weight: bold;
				margin-bottom: 10rpx;
			}

			.phone {
				font-size: 28rpx;
				color: #666;
				margin-bottom: 10rpx;
			}

			.company-type {
				font-size: 26rpx;
				color: #888;
			}
			.main-string {
				margin: 0 10rpx;
			}
		}
	}

	.certification {
		background-color: #fff;
		border-radius: 16rpx;
		margin-bottom: 20rpx;
		padding: 0 30rpx;

		.cert-item {
			display: flex;
			justify-content: space-between;
			align-items: center;
			height: 100rpx;
			font-size: 28rpx;

			.cert-status {
				color: #19be6b;
			}
		}
	}

		.dial-nav{
			margin: 0px 0px 10px 0px;
			border-radius: 16rpx 16rpx 16rpx 16rpx;
			background-color: #fff;			
		}
		
		
	.function-list {
		background-color: #fff;
		border-radius: 16rpx;

		/deep/ .u-cell {
			padding: 28rpx 30rpx;
		}

		/deep/ .u-cell__body {
			padding: 0;
		}

		/deep/ .u-cell__value {
			color: #f56c6c;
		}
	}
</style>